﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_USR_FAVORITE_SEARCH_Select')
	BEGIN
		DROP Procedure usp_UPDMS_USR_FAVORITE_SEARCH_Select
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_USR_FAVORITE_SEARCH_Select
**	Desc : 검색결과 즐겨찾기를 조회한다.
**	Test Exec Query : Exec usp_UPDMS_USR_FAVORITE_SEARCH_Select 'smstyle', 'Crd1012m'
**	Called by : Usr_Dac_UPDMS_USR_FAVORITE_SEARCH.cs
**	Program ID : Usr1011m
**	Auth : 송시명
**	Date : 2014-08-19
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**			
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_USR_FAVORITE_SEARCH_Select]
@ls_user_id nvarchar(20),
@ls_pgm_id nvarchar(20)
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET NOCOUNT ON

SELECT A.Title,
	   CONVERT(VARCHAR, A.Seq) + '|' + '../' + B.Pgm_Class + '/' + B.Pgm_Url + '?sm=' + Dir_Depth + A.Search_Condition AS Seq_Url
  FROM UPDMS_USR_FAVORITE_SEARCH A WITH(NOLOCK)
  JOIN UPDMS_COM_PGM B WITH(NOLOCK) ON A.Pgm_Id = B.Pgm_Id
 WHERE A.User_Id = @ls_user_id
   AND A.Pgm_Id = @ls_pgm_id

GO